<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.sql.*,java.util.*"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Record</title>
</head>
<body>
<%
    Connection conn = null;
    Statement stmt = null;

    String StudentID = (String)session.getAttribute("StudentID");
	String courseID = request.getParameter("courseid");
	String record = "";
	String courseName = "";
    
    try {
      Class.forName("com.mysql.jdbc.Driver");
      conn = DriverManager.getConnection("jdbc:mysql://140.119.19.171/klp","case", "12345");
      stmt = conn.createStatement();
	  String sql1 = "SELECT c.C_Name , t.record FROM klp.course c , klp.elective e , klp.pair p , klp.master m , klp.talk t where e.Pair_No = t.Pair_No And e.Pair_No = p.Pair_No AND e.C_No = c.C_No AND p.Pair_No = m.Pair_No AND m.angel_Id = '" + StudentID + "' AND p.Type = 'Master'";
      ResultSet rs = stmt.executeQuery(sql1);    

      //String A[] = new String[rs.getRow()];
      //String B[] = new String[rs.getRow()];
      //int i = 0;
      //do{
    	//  A[i] = rs.getString(0);
    	//  B[i] = rs.getString(1);
    	//  i++;
      //}while(rs.next());
       if (rs.next()){
			courseName = rs.getString("C_Name");
			record = rs.getString("record");
       }
    //  rs.close();
    }
    catch(SQLException e) {

    }
    finally {
        try {
            stmt.close();
            conn.close();
        }
        catch(SQLException e) {

        }
    }
 %>

 <%=courseName%>的小天使 對你說：<%=record%>
  
</body>
</html>